﻿package
{
	import flash.display.Bitmap;
	import org.flixel.*;
	import StateGameLoop;
		
	public class StateTitleScreen extends FlxState
	{	[Embed(source = 'data/title.png')] private var ImgTitleScreen:Class;
	
		private var _pressStart:FlxText = new FlxText(99,  FlxG.height - 50, FlxG.width, "PRESS SPACE TO START");
		private var _pressStartShadow:FlxText = new FlxText(100, FlxG.height - 49, FlxG.width, "PRESS SPACE TO START");
		private var _imgTitle:FlxSprite = new FlxSprite(0, 0, ImgTitleScreen);
		private var _imgTitle2:FlxSprite = new FlxSprite(0, 0, ImgTitleScreen);
	
		override public function StateTitleScreen():void
		{
			this.add(_imgTitle);
			
			this.add(_pressStartShadow);
			_pressStartShadow.color = 0;
			this.add(_pressStart);
			_pressStart.color = 0xFFFFFF;
		
		}
		override public function update():void
		{
			if (FlxG.keys.SPACE) {
				start();
			}
			
			super.update();
		}
		
		/*-------------------------------------*/
		private function onFade():void
		{
			FlxG.switchState(StateGameLoop);
		}
		
		/*-------------------------------------*/
		private function onTitleClick():void
		{
			start();
		}
		
		/*-------------------------------------*/
		private function start():void
		{
			//FlxG.flash(0xffffffff, 0.75);
			FlxG.fade(0xff000000, 0.10, onFade,true);
		}
	}
}